package cn.edu.dlut.port.isp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import cn.edu.dlut.port.isp.bean.vote.ResultBean;
import cn.edu.dlut.port.isp.bean.vote.VoteBean;

@Service
public class VoteServiceImp implements VoteService{
	@Autowired
	private JdbcTemplate jt;

	@Override
	public VoteBean getVoteResult() {
		List<VoteBean> list=jt.query("select * from vote",
				new BeanPropertyRowMapper<VoteBean>(VoteBean.class));
		return list.get(0);
		
	}

	@Override
	public ResultBean getVoteResult2() {
		// TODO Auto-generated method stub
		ResultBean resultBean=new ResultBean();
		resultBean.setData1(75.160);
		resultBean.setData2(68.870);
		resultBean.setData3(0.4974);
		resultBean.setData4(0.4077);
		return resultBean;
	}
}
